import request from "@/common/http";
import recommendProductJson from './mock/recommendProduct.json'
import recommendSubjectJson from './mock/recommendSubject.json'
import {RecommendProduct, RecommendSubject} from "@/common/interfaces/sms";

export async function queryRecommendProduct(params?: any, useMock?: boolean) {
  if (useMock) {
    return Promise.resolve(recommendProductJson)
  }
  return request('/api/sms/homerecommendproduct/list', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function removeRecommendProduct(params: { ids: number[] }) {
  return request('/api/sms/homerecommendproduct/delete', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function addRecommendProduct(params: any) {
  return request('/api/sms/homerecommendproduct/add', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function updateRecommendProduct(params: RecommendProduct) {
  return request('/api/sms/homerecommendproduct/update', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function queryRecommendSubject(params?: any, useMock?: boolean) {
  if (useMock) {
    return Promise.resolve(recommendSubjectJson)
  }
  return request('/api/sms/homerecommendsubject/list', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function removeRecommendSubject(params: { ids: number[] }) {
  return request('/api/sms/homerecommendsubject/delete', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function addRecommendSubject(params: RecommendSubject) {
  return request('/api/sms/homerecommendsubject/add', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function updateRecommendSubject(params: RecommendSubject) {
  return request('/api/sms/homerecommendsubject/update', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

